{ Russian Olympiad. 1 stage.
  Problemset: http://agul-problems1.googlecode.com/svn/trunk/2010-2011/roi/stage1/roi_1stage.doc
  Problem 4
  Points: 20
}
var i:longint; a,b,flag1,flag2,flag3,flag:longint; arr1,arr2,arr3:array[1..11] of longint;
procedure fill(n:longint);
var i:integer;
begin
flag3:=0;
if n=0 then begin
  flag3:=1;
  arr3[flag3]:=0;
end else begin
  while n<>0 do begin
    inc(flag3);
    arr3[flag3]:=n mod 10;
    n:= n div 10;
  end;
  flag1:=0;
  for i:=flag3 downto 1 do begin
    inc(flag1);
    arr1[flag1]:=arr3[i];
  end;
end;
end;
procedure fill_2(n:longint);
var i:integer;
begin
flag3:=0;
if n=0 then begin
  flag3:=1;
  arr3[flag3]:=0;
end else begin
  while n<>0 do begin
    inc(flag3);
    arr3[flag3]:=n mod 10;
    n:= n div 10;
  end;
  flag2:=0;
  for i:=flag3 downto 1 do begin
    inc(flag2);
    arr2[flag2]:=arr3[i];
  end;
end;
end;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
readln(a,b);
for I := 1 to 11 do begin
  arr1[i]:=0;
  arr2[i]:=0;
  arr3[i]:=0;
end;
fill(a);
fill_2(b);
flag:=1;
for i:=1 to flag2 do begin
  if flag<=flag1 then begin
    if arr2[i]=arr1[flag] then inc(flag);
  end;
end;
if flag>flag1 then writeln('YES') else writeln('NO');
close(input);
close(output);
end.